Function Reference

_GUICtrlComboGetEditSel

Get the starting and ending character positions of the current selection in the edit control of a combo box.

#Include <GuiCombo.au3>
_GUICtrlComboGetEditSel($h_combobox)

 

Parameters

$h_combobox control id/control hWnd

 

Return Value

Array containing the starting and ending selected positions, first element ($array[0]) contains the number of elements
If an error occurs, the return value is $CB_ERR.

 

Remarks

$array[1] - starting position
$array[2] - ending position

 

Related

_GUICtrlComboSetEditSel

 

Example


#include <GuiConstants.au3>
#include <GuiCombo.au3>

opt('MustDeclareVars', 1)

Dim $Combo, $Btn_Exit, $msg, $Status

GUICreate("ComboBox Get Edit Sel", 392, 254)

$Combo = GUICtrlCreateCombo("", 70, 10, 270, 100, $CBS_SIMPLE)
GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language", "freeware")
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 200, 90, 30)

$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
Local $a_sel = _GUICtrlComboGetEditSel($Combo)
If (IsArray($a_sel)) Then
   GUICtrlSetData($Status, "Chars Position Selected From: " & $a_sel[1] & " To: " & $a_sel[2])
EndIf

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
         ExitLoop
   EndSelect
WEnd
Exit